package cn.larry.aop.service.within;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

/**
 * @Pointcut("within(cn.larry.aop..within..*)")
 * 
 * @author Larry
 *
 */
@Service
public class WithinService {
	Logger logger = LoggerFactory.getLogger(WithinService.class);

	public String hi() {
		logger.info("cn.larry.aop.service.within.WithinService.hi()");
		privateMethod();
		protectedMethod();
		return "hi";
	}

	public String hey() {
		logger.info("cn.larry.aop.service.within.WithinService.hey()");
		return "hey";
	}

	public Exception throwEx() throws Exception {
		logger.info("cn.larry.aop.service.within.WithinService.throwEx()");
		throw new Exception();
	}

	public Integer div(int a, int b) throws Exception {
		return a / b;
	}

	private void privateMethod() {}

	protected void protectedMethod() {
		privateMethod();
	}
}
